package com.stylefeng.guns.modular.system.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.stylefeng.guns.core.validater.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotNull;
import java.io.Serializable;


 /**
 * 系统字典表
 *
 * @author 张亚林
 * @Date 2018-10-30 17:07
 * @TableField(exist = false) 实现属性与数据库字段不一一对应
 */
 @Data
 @EqualsAndHashCode(callSuper=true)
 @TableName("sys_dict")
public class SysDict extends Model<SysDict> {
    private static final long serialVersionUID = 1L;
    /**
     * 主键id
     * 自动生成后修改成实际的主键 
     */
    protected Serializable pkVal() {
        return this.id;
    }
    
    //扩展能查询字段
    @TableField(exist = false)
    @JSONField(serialize = false)
    private String key ;
    //开始日期
    @TableField(exist = false)
    @JSONField(serialize = false)
    private String sdate;
    //截止日期 
    @TableField(exist = false)
    @JSONField(serialize = false)
	private String edate;
    //排序字段
    @TableField(exist = false)
    @JSONField(serialize = false)
	private String  sortField ;
	//排序	
	@TableField(exist = false)
    @JSONField(serialize = false)
	private String sortOrder;

	
    @ApiModelProperty(value = "主键id")
    @TableId(value = "id", type= IdType.AUTO)
    @NotNull(message = "编号不能为空",groups = {Update.class})
    private Integer id;     //主键id

    @ApiModelProperty(value = "排序")
    @TableField("num")
    private Integer num;     //排序

    @ApiModelProperty(value = "父级字典")
    @TableField("pid")
    private Integer pid;     //父级字典

    @ApiModelProperty(value = "名称")
    @TableField("name")
    @NotNull(message = "名称不能为空")
    private String name;     //名称

    @ApiModelProperty(value = "提示")
    @TableField("tips")
    private String tips;     //提示

    @ApiModelProperty(value = "值")
    @TableField("code")
    @NotNull(message = "代码不能为空")
    private String code;     //值


}
